#include "Counter.h"


template<typename CountValue>
Counter<CountValue>::Counter()
{}

template<typename CountValue>
Counter<CountValue>::Counter(CountValue c, CountValue m)
{
	initial = c;
	count = c;
	max = m;
}

template<typename CountValue>
void Counter<CountValue>::operator++()
{
	if(count==max)
		count = initial;
	else
		count++;
}

template<typename CountValue>
void Counter<CountValue>::operator--()
{
	if(count==initial)
		count = max;
	else
		count--;
}

template<typename CountValue>
void Counter<CountValue>::operator++(int i)
{
	if(count==max)
		count = initial;
	else
		count++;
}

template<typename CountValue>
void Counter<CountValue>::operator--(int i)
{
	if(count==initial)
		count = max;
	else
		count--;
}

template<typename CountValue>
void Counter<CountValue>::resetCount(CountValue c)
{
	count = c;
	initial = c;
}
template<typename CountValue>
CountValue Counter<CountValue>::getCount()
{
	return count;
}

template<typename CountValue>
CountValue Counter<CountValue>::getMax()
{
	return max;
}

template<typename CountValue>
bool Counter<CountValue>::flag()
{
	if(count==max)
		return true;
	else
		return false;
}

